def studentSystem():
  a=[]
  from operator import itemgetter
  for i in range(3):
    a.append([])
    p=0
    for j in range(4):
      if j==0:
        a[i].append(input("请输入学生姓名:"))
      else:
        s=float(input(f"请输入学生第{j}科成绩:"))
        a[i].append(s)
        p=p+s
        if j==3:
          a[i].append(p)
  while True:
    print("---------菜单----------")

    print("1.按语文成绩排序")
    print("2.按数学成绩排序")
    print("3.按英语成绩排序")
    print("4.按总分排序")
    print("0.退出程序")
    nchoice=input("请输入你的选择:")
    if nchoice=="1":
      print(sorted(a,key=itemgetter(1),reverse=True))
    if nchoice=="2":
      print(sorted(a,key=itemgetter(2),reverse=True))
    if nchoice=="3":
      print(sorted(a,key=itemgetter(3),reverse=True))
    if nchoice=="4":
      print(sorted(a,key=itemgetter(4),reverse=True))
    if nchoice=="0":
      print("欢迎下次再来")
      break
studentSystem()
      